<template>
	<!-- <u-cell-group>
		<u-cell-item title="退出登录" @click="logout" >
		</u-cell-item>
		<u-cell-item title="修改用户信息" @click="alter" >
		</u-cell-item>
		<u-cell-item title="绑定微信" @click="bind" >
		</u-cell-item>
		<u-cell-item title="验证手机号" @click="check" >
		</u-cell-item>
	</u-cell-group> -->
    <uni-list>
    	<uni-list-item  showArrow="true" title="退出登录"
    		@click="logout" link />
    	<uni-list-item  showArrow="true"  title="修改用户信息"
    		@click="alter" link />
    	<uni-list-item  showArrow="true"  title="绑定微信"
    		@click="bind" link />
    </uni-list>
</template>

<script>
export default {
	data() {
		return {
		};
	},
	methods:{
		logout(){
			getApp().globalData={
			id:"2",
			username:"aaa",
			password:"sss",
			level:'1',
			job:"aaa",
			phone:"sss"
		};
		// console.log(getApp().globalData.id);
			// uni.navigateTo({
			// 	url:"../normal/login"
			// })
			uni.reLaunch({
				url:"../login"
			})
		},
		alter(){
			uni.navigateTo({
				url:"../normal/alter/index"
			})
		},
		bind(){
			wx.login({
				desc: '用于完善用户资料',
				success: (res) => {
					console.log("获取成功", res);
					uni.request({
						url:"http://localhost:8081/user/registerByWX?code=" + res.code + "&uid=" + getApp().globalData.id,
						method:"POST",
						
					}).then(result=>{
						if(result[1].data.code==200){
							uni.showToast({
								title:"绑定成功",
								icon:"success"
							})
						}
					})
				},
				fail:(err)=>{
					uni.showToast({
						title:"获取失败",
						icon:"error"
					})
				}
			});
			
		}
	},
	onLoad() {
		

	}
};
</script>

<style lang="scss" scoped></style>
